import service from '/@/utils/request';

export const categoryApi = {
    listCategory: (query?: CategoryQueryDto) => {
        return service.get<PageResult<CategoryVo>, CategoryQueryDto>('/admin/category', {
            params: query
        });
    },
    getCategory(categoryId: number) {
        return service.get<CategoryVo>(`/admin/category/${categoryId}`);
    },
    addCategory(categoryAddDto: CategoryAddDto) {
        return service.post<CategoryVo>(`/admin/category`, categoryAddDto);
    },
    editCategory(categoryUpdateDto: CategoryUpdateDto) {
        return service.put<CategoryVo>(`/admin/category`, categoryUpdateDto);
    },
    deleteCategory(categoryId: number) {
        return service.delete<boolean>(`/admin/category/${categoryId}`);
    },

}